#include <bits/stdc++.h>
using namespace std;
multiset<int> s;
bool s1(int x){
    int a, b;
    auto it = --s.upper_bound(x);
    if(it == s.begin()) return false;
    else a = *(--it);
    if(it == s.begin()) return false;
    else b = *(--it);
    return a+b>x;
}
bool s2(int x){
    int a, b;
    if(s.count(x) == 1){
        auto it = s.find(x);
        if(it == s.begin()) return false;
        else a = *(--it);

        ++it;
        ++it;
        if(it == s.end()) return false;
        else b = *it;
        return a+x>b;
    }else{
        auto it = s.lower_bound(x);
        if(it != s.begin()) return true;
        else{
            it = s.upper_bound(x);
            ++it;
            if(it == s.end()) return false;
            else b = *it;
            return x+x>b;
        }
    }

}
bool s3(int x){
    int a, b;
    auto it = s.lower_bound(x);
    ++it;
    if(it == s.end()) return false;
    else a = *it;

    ++it;
    if(it == s.end()) return false;
    else b = *it;
    return x+a>b;
}
int main() {
    ios_base::sync_with_stdio(false);cin.tie(nullptr);

    int op; cin >> op;
    for (int i = 1; i <= op; ++i) {
        int q; cin >> q;
        int x; cin >> x;
        if(q == 1) s.insert(x);
        else if(q == 2) s.erase(x);
        else {
            s.insert(x);
            if((s.size()>=3 &&(s1(x) || s2(x) || s3(x))) || s.count(x)>=3) cout <<"Yes\n";
            else cout <<"No\n";
            s.erase(s.find(x));
        }

    }
    return 0;
}